package cn.tsyz.local.common.exception;

/**
 * 错误码枚举
 */
public enum ErrorCode {

    // 系统级错误 (1000-1999)
    SYSTEM_ERROR(1000, "系统异常"),
    PARAM_ERROR(1001, "参数错误"),
    UNAUTHORIZED(1002, "未授权访问"),
    FORBIDDEN(1003, "权限不足"),

    // 业务级错误 (2000-2999)
    USER_NOT_FOUND(2001, "用户不存在"),
    USER_ALREADY_EXISTS(2002, "用户已存在"),
    USERNAME_OR_PASSWORD_ERROR(2003, "用户名或密码错误"),
    USER_DISABLED(2004, "用户已被禁用"),

    // 参数校验错误 (3000-3999)
    PARAM_IS_NULL(3001, "参数不能为空"),
    PARAM_FORMAT_ERROR(3002, "参数格式错误"),
    PARAM_LENGTH_ERROR(3003, "参数长度不正确");

    private final Integer code;
    private final String message;

    ErrorCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
